import React, { useState } from "react";
import { Button, View, StyleSheet } from "react-native";
import DateTimePickerModal from "react-native-modal-datetime-picker";
import Btn from '../../common/Btn'

const Clock = () => {

  const [isTimePickerVisible, setTimePickerVisibility] = useState(false);

  const showTimePicker = () => {
    setTimePickerVisibility(true);
  };

  const hideTimePicker = () => {
    setTimePickerVisibility(false);
  };

  const handleConfirm = (time) => {
    // console.warn("A time has been picked: ", time);
    console.log(time)
    hideTimePicker();
  };

  return (
    <View>
      {/* <Button style={{backgroundColor:'#918BD3'}} title="快来定个时间吧" onPress={showTimePicker} /> */}
      <Btn onPress={()=>{showTimePicker()}} title="nihao">点我</Btn>
      <DateTimePickerModal
        isVisible={isTimePickerVisible}
        mode="time"
        onConfirm={handleConfirm}
        onCancel={hideTimePicker}
      />
    </View>
  );
};

export default Clock;









// import React, { useState } from "react";
// import { Button, View, StyleSheet } from "react-native";
// import DateTimePickerModal from "react-native-modal-datetime-picker";
// import Btn from '../../common/Btn'

// const Clock = () => {

//   const [isTimePickerVisible, setTimePickerVisibility] = useState(false);

//   const showTimePicker = () => {
//     setTimePickerVisibility(true);
//   };

//   const hideTimePicker = () => {
//     setTimePickerVisibility(false);
//   };

//   const handleConfirm = (time) => {
//     // console.warn("A time has been picked: ", time);
//     console.log(time)
//     hideTimePicker();
//   };

//   return (
//     <View>
//       {/* <Button style={{backgroundColor:'#918BD3'}} title="快来定个时间吧" onPress={showTimePicker} /> */}
//       <Btn onPress={()=>{showTimePicker()}} title="nihao">点我</Btn>
//       <DateTimePickerModal
//         isVisible={isTimePickerVisible}
//         mode="time"
//         onConfirm={handleConfirm}
//         onCancel={hideTimePicker}
//       />
//     </View>
//   );
// };

// export default Clock;